Skip to content

RH adapter: races start on Grid's go (effective-format zeroing) + stage retry + stale-replay gate#372

Merged
ryan-johnson2 merged 1 commit into
develfrom
rh-start-sync
Jul 5, 2026
Merged

RH adapter: races start on Grid's go (effective-format zeroing) + stage retry + stale-replay gate#372
ryan-johnson2 merged 1 commit into
develfrom
rh-start-sync

Conversation

@ryan-johnson2

Copy link
Copy Markdown
Contributor

Root-caused the 'lap reads 7s, arrives 25s' report. RH races the seated heat's class format — not the format prepare_instant_start had zeroed — so stock RH staging (~5s, worse on a bloated DB) ran on top of Grid's go, skewing every live surface while results stayed self-consistent. The prepare now re-runs immediately before stage_race (effective format current, RH READY). Plus: a 5s stage retry for busy-RH dropped stages, and a per-arming RACING gate that drops pre-start lap records (a busy RH replays the previous race's snapshot — this contaminated a fresh heat with the old race's laps, observed live).

Measured on the rig (websocket path, the console's actual data path): lap visibility latency fell from a constant ~7.1s to 0.28–0.37s (median 0.32s).

Workspace tests + --features live build + lint clean.

🤖 Generated with Claude Code

…etry, stale-replay gate

The field report ('first lap reads 7s but arrived 25s into the race') unwound
into three RH-adapter defects, diagnosed by probing the console's actual
websocket path against a live rig:

- prepare_instant_start zeroed the staging delays of the format that was
  current AT STAGE TIME — but seating the heat switches RH's effective format
  to the heat's CLASS format (RHRace's class_format_id override), so the race
  staged with STOCK multi-second staging tones + delays on top of Grid's own
  start procedure. Every race began ~5-7s after Grid's go (a DB-bloated RH
  stretched it past 15s); lap stamps stayed race-relative so results were
  self-consistent and the skew was invisible everywhere except live: laps,
  tones, and callouts all arrived that late. The prepare now re-runs right
  before stage_race, when the effective format is current and RH is READY.
  Measured on the rig: the websocket-path lap latency fell from a constant
  ~7.1s to 0.28-0.37s (median 0.32s).
- A busy RH ('Attempted to stage race while status is not ready') silently
  DROPS a stage — the race never starts and no passes record. The driver now
  re-emits stage_race every 5s inside the settle window until RH confirms
  RACING (paced above RH's stock staging so a retry can never restart a
  countdown in progress).
- Lap records drained BEFORE this arming's RACING confirmation are a stale
  replay — a busy RH re-broadcasts the PREVIOUS race's current_laps snapshot,
  and remapping it contaminated the fresh heat with the last race's laps
  (observed live: a new heat opening on lap 6+). ArmedHeat now carries a
  started flag (set on SessionStarted, shared across reconnects so mid-race
  snapshot replays still dedup) and pre-start passes are dropped.

Operational note: a long-lived test rig accumulates RH heats (one per race,
'Heat 166' by tonight) and slows staging/saves — reset the container's DB
periodically; the retry + gate make the failure mode safe rather than corrupt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ryan-johnson2 ryan-johnson2 merged commit bd93c43 into devel Jul 5, 2026
3 checks passed
@ryan-johnson2 ryan-johnson2 deleted the rh-start-sync branch July 5, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant